package net.kts.subskill.adapter;

import java.util.List;


import net.kts.main.R;
import net.kts.subskill.conversation.model.Conversation;




import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class SubskillConversationAdapter extends ArrayAdapter<Conversation> {

	public SubskillConversationAdapter(Context context, int textViewResourceId,
			List<Conversation> objects) {
		super(context, textViewResourceId, objects);
		// TODO Auto-generated constructor stub
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		
		View v = convertView;
		
		if(v != null) {
			return v;
		}
		
		
		
		LayoutInflater vi = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v = vi.inflate(R.layout.subskill_conversation_row, null);
        
        Conversation conversation = getItem(position);
		v.setTag(conversation);
//		int iGubun = str.indexOf("||");
//		
//		String title = str.substring(0, iGubun);
//		String trans = str.substring(iGubun+2);
		
		
		TextView oriText = (TextView)v.findViewById(R.id.subskill_conversation);
		TextView transText = (TextView)v.findViewById(R.id.subskill_conversation_trans);
		
		
		oriText.setText(conversation.getLang());
		transText.setText(conversation.getKo());
		
		
		return v;	
	}
	
	

}
